<?php
//define('CMS_ADMIN', true);
require_once("../config.php");
require_once("language/".$currentlang."/menu.php");
if(@in_array($listmenus,$file_menu)) {
		$seld =" checked";
	}
if(defined('iS_ADMIN')) 
{
	//$not_accept_mod = array("blocks","modules","configuration","adminlog");
	$not_accept_mod=array();
	echo "<div class=\"div-header\">";
	echo "<div class=\"div-banner\"><span class=\"version\">"._VERSION_ADOOSITE."<br>"._HELLO.": <b>$admin_ar[0]</b></span></div>";
	echo "</div>";
	echo "<div class=\"div-content\">";
	echo "<div id=\"ddtopmenubar\" class=\"mattblackmenu\" style=\"float:left\">";
	echo "<ul>";
	
	//tra ve mang menu duoc cap quyen truy cap
	$result = $db->sql_query("SELECT menus FROM ".$prefix."_admin WHERE adacc='$admin_ar[0]'");
	if(empty($admin_ar[0]) || $db->sql_numrows($result) != 1) 
	{
		echo"error";
	}
	list($menus) = $db->sql_fetchrow($result);
	$auth_menus2 = @explode("|",$menus);
	$i=0;
	$resultmenu = $db->sql_query("SELECT * FROM ".$prefix."_admin_menu where action = '1' ORDER BY weight");
	while(list($mid, $file_menu, $weight, $action) = $db->sql_fetchrow($resultmenu)) 
	{
		if (file_exists("menus/adm_".$file_menu.".php") && (defined('iS_RADMIN') || (checkPermAdm($file_menu) && !in_array($file_menu,$not_accept_mod)))) 
		{
			if(@in_array($listmenus[$i],$auth_menus2) || defined('iS_RADMIN')) 
			{
				include("menus/adm_".$file_menu.".php");
				if($menu_main != "" && $submenu !="") 
				{
					echo "<li><a href=\"#\"  rel=\"ddsubmenu$i\">$menu_main</a></li>";
					echo "<ul id=\"ddsubmenu$i\" class=\"ddsubmenustyle\">";
					for($a =0; $a < sizeof($submenu); $a ++) 
						echo "".$submenu[$a]."";
					echo "</ul>";
				}
				else
				{
					echo "<li><a href=\"".$menu_main_link."\" target=\"_top\" class=\"catmenu\">$menu_main</a></li>";
				}
			}
			
		}
		$i++;
	}
	echo "<li><a href=\"logout.php\" target=\"_top\" title=\""._LOGOUT."\" onclick=\"return confirm('"._LOGOUTASK."');\" class=\"catmenu1\">"._LOGOUT."</a></li>";
	echo "</ul>";
	echo "</div >";
	echo "<div  style=\"clear:left\"></div>";
	echo "<script type=\"text/javascript\">";
	echo "ddlevelsmenu.setup(\"ddtopmenubar\", \"topbar\") //ddlevelsmenu.setup(\"mainmenuid\", \"topbar|sidebar\")";
	echo "</script>";
}else{
	header("Location: login.php");
}
?>
